#!/bin/bash

CURRENT_DIR=$(
   cd "$(dirname "$0")"
   pwd
)

echo ${CURRENT_DIR}

function log() {
   message="[PLM Log]: $1 "
   echo -e "${message}" 2>&1 | tee -a ${CURRENT_DIR}/install.log
}

log  "1.初始化--环境变量 "
source ${CURRENT_DIR}/plm-deploy/.env
cat > ${CURRENT_DIR}/plm-deploy/.env <<EOF
CURRENT_DIR=${CURRENT_DIR}
EOF
log  "2.赋予权限 "
chmod 777 -R  ${CURRENT_DIR}/PLM
chmod 777 -R  ${CURRENT_DIR}/plm-deploy

log "3.执行命令 启动服务 "
cd ${CURRENT_DIR}/plm-deploy/
docker-compose up -d
log "启动服务成功 "





